import { PageParam } from '@/services/common'
import { NFBaseService } from '@/services/NFBaseService'
import { covertTableData } from '@/utils/tableUtil'
import { request } from '@umijs/max'
import { Dialogue } from '../../types/kf'

export interface DialogueQueryDTO {
  id?: string
}

export interface DialogueUpdateDTO {
  id?: string
}

export interface DialogueFormBO {
  id?: string
}

// 分页查询请求对象
interface DialoguePageQueryDTO extends DialogueQueryDTO, Required<PageParam> {}

class DialogueService extends NFBaseService<Dialogue, DialogueQueryDTO, DialogueUpdateDTO> {
  protected _bizName: string = 'dialogue'
  getSchema = async (params: DialoguePageQueryDTO) => {
    let data = await request<Dialogue[]>(`/api/v2/dialogue/schema`, { params })
    return covertTableData(data)
  }
}

export const dialogueService = new DialogueService()
